<?php
include '../conn.php';
$data = json_decode($HTTP_RAW_POST_DATA);
$sql = "select * from users_info
        where username = '$data->username' and password = '$data->password'";
$req = $pdo->getOne($sql);
if($req){
    $arr = [
        "code" => 200,
        "desc" => "登录成功",
        "userInfo" => [
            "id" => $req['id'],
            "nickname" => $req['nickname'],
            "avatar" => "$url$req[avatar]"
        ]
    ];
}else{
    $arr = [
        "code" => 400,
        "desc" => "账号或密码错误"
    ];
}
echo json_encode($arr);